#!/usr/bin/env python
#coding=utf-8
from google.appengine.api import mail
from sso.Config import Config
import hashlib
def send_verify_mail(info):
    mail_conf = Config.get_instance()['mail']
    sender = mail_conf['sender']
    subject = mail_conf['subject']
    enc_data = mail_conf['enc_key']+info['email']
    v = hashlib.md5(enc_data).hexdigest()
    verify_url = mail_conf['verify_url'] % (v, info['email'])
    message = mail.EmailMessage(sender=sender,subject=subject)
    msg_body = mail_conf['msg_body'].encode('utf-8') % (info['username'], info['username'], info['email'], info['username'], verify_url)
    message.to = info['email']
    message.body = msg_body
    message.send()
    